<template>
        <el-select
            placeholder="请选择"
            clearable
           :value="value"
           @change="Onabserd"
          >
            <el-option
              v-for="item in channelOptions"
              :key="item.id"
              :label="item.name"
              :value="item.id"
            >
            </el-option>
        </el-select>
</template>
<script>
export default {
  props: {
    value: {
      type: Number,
      default: 0
    }
  },
  data () {
    return {
      channelOptions: []
    }
  },
  created () {
    this.getChannels()
  },
  methods: {
    // 获取频道列表
    async getChannels () {
      const res = await this.$http.get('/v1_0/channels')
      // console.log(res)
      this.channelOptions = res.data.data.channels
    },
    Onabserd (value) {
      this.$emit('input', value)
      // console.log(value)
    }
  }

}
</script>
<style>

</style>
